home *** CD-ROM | disk | FTP | other *** search
-
- /*
- * (a) (C) 1990 by Adobe Systems Incorporated. All rights reserved.
- *
- * (b) If this Sample Code is distributed as part of the Display PostScript
- * System Software Development Kit from Adobe Systems Incorporated,
- * then this copy is designated as Development Software and its use is
- * subject to the terms of the License Agreement attached to such Kit.
- *
- * (c) If this Sample Code is distributed independently, then the following
- * terms apply:
- *
- * (d) This file may be freely copied and redistributed as long as:
- * 1) Parts (a), (d), (e) and (f) continue to be included in the file,
- * 2) If the file has been modified in any way, a notice of such
- * modification is conspicuously indicated.
- *
- * (e) PostScript, Display PostScript, and Adobe are registered trademarks of
- * Adobe Systems Incorporated.
- *
- * (f) THE INFORMATION BELOW IS FURNISHED AS IS, IS SUBJECT TO
- * CHANGE WITHOUT NOTICE, AND SHOULD NOT BE CONSTRUED
- * AS A COMMITMENT BY ADOBE SYSTEMS INCORPORATED.
- * ADOBE SYSTEMS INCORPORATED ASSUMES NO RESPONSIBILITY
- * OR LIABILITY FOR ANY ERRORS OR INACCURACIES, MAKES NO
- * WARRANTY OF ANY KIND (EXPRESS, IMPLIED OR STATUTORY)
- * WITH RESPECT TO THIS INFORMATION, AND EXPRESSLY
- * DISCLAIMS ANY AND ALL WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR PARTICULAR PURPOSES AND NONINFRINGEMENT
- * OF THIRD PARTY RIGHTS.
- */
-
- /*
- * ClockApp.m
- *
- * This class creates the window that the clock goes in and then
- * installs a ClockView object as the content view. The clock is
- * initialized by drawing the clock face, sending the user paths for
- * the hands down to the server and defining the gstates.
- *
- * Version: 2.0
- * Author: Ken Fromm
- * History:
- * 03-07-91 Added this comment.
- */
-
- #import "ClockApp.h"
- #import "ClockView.h"
- #import <appkit/Application.h>
- #import <appkit/Control.h>
- #import <appkit/Window.h>
-
- @implementation ClockApp
-
- /*
- * Create a window, install a ClockView object as the content view and
- * initialize the clock.
- */
- + new
- {
- NXRect aRect;
-
- self = [super new];
-
- NXSetRect(&aRect, 250.0, 400.0, 400.0, 375.0);
- windowId = [Window newContent:&aRect
- style:NX_TITLEDSTYLE
- backing:NX_BUFFERED
- buttonMask:NX_RESIZEBUTTONMASK
- defer:NO];
- [windowId setTitle:"Clock"];
-
- viewId = [ClockView new];
- [[windowId setContentView:viewId] free];
-
- [viewId drawFace];
- [viewId defineUPaths];
- [viewId defineGStates];
-
- [windowId display];
- [windowId makeKeyAndOrderFront:self];
-
- return self;
- }
-
- /* The view is freed when the window is freed. */
- - free
- {
- [windowId free];
-
- return [super free];
- }
-
- /* Set the target and actions for the buttons. */
- - setGstateButton:anObject
- {
- [[anObject setTarget:viewId] setAction:@selector(toggleGstate:)];
-
- return self;
- }
-
- - setUpathButton:anObject
- {
- [[anObject setTarget:viewId] setAction:@selector(toggleUpath:)];
-
- return self;
- }
-
- - setTraceItem:anObject
- {
- [[anObject setTarget:viewId] setAction:@selector(trace:)];
-
- return self;
- }
-
- /* Pass the id for the time display field to the ClockView object. */
- - setDisplayTime:anObject
- {
- [viewId setDisplayTime:anObject];
-
- return self;
- }
-
- @end
-